package com.api.tiny.mirror.service.product;

import com.api.tiny.mirror.service.product.constant.ProductApiConstants;
import com.api.tiny.mirror.service.product.request.CreateAppRequest;
import com.api.tiny.mirror.service.product.request.PageAppRequest;
import com.api.tiny.mirror.service.product.request.UpdateAppRequest;
import com.api.tiny.mirror.service.product.response.AppVO;
import com.tiny.mirror.basic.web.dto.response.BasePageResponse;
import com.tiny.mirror.basic.web.dto.response.BaseResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @Author: lanpai
 * @Description:
 * @Date: Create in 2022/10/17
 */
@Validated
@Tag(name = "应用接口", description = "应用接口")
public interface AppApiService {

  @Operation(summary = "分页查询应用信息信息")
  @PostMapping(
      value = ProductApiConstants.APP_API_PREFIX + "/page",
      produces = MediaType.APPLICATION_JSON_VALUE,
      consumes = MediaType.APPLICATION_JSON_VALUE
  )
  BasePageResponse<AppVO> page(
      @RequestBody @Validated PageAppRequest request
  );

  @Operation(summary = "查询应用信息详细")
  @GetMapping(
      value = ProductApiConstants.APP_API_PREFIX + "/{id}",
      produces = MediaType.APPLICATION_JSON_VALUE
  )
  BaseResponse<AppVO> getInfo(@PathVariable(value = "id") Long id);

  @Operation(summary = "创建应用信息")
  @PostMapping(
      value = ProductApiConstants.APP_API_PREFIX,
      produces = MediaType.APPLICATION_JSON_VALUE,
      consumes = MediaType.APPLICATION_JSON_VALUE
  )
  BaseResponse<Long> create(@RequestBody @Validated CreateAppRequest request);

  @Operation(summary = "修改应用信息")
  @PutMapping(
      value = ProductApiConstants.APP_API_PREFIX,
      produces = MediaType.APPLICATION_JSON_VALUE,
      consumes = MediaType.APPLICATION_JSON_VALUE
  )
  BaseResponse<Void> update(@RequestBody @Validated UpdateAppRequest request);

  @Operation(summary = "删除应用信息")
  @DeleteMapping(
      value = ProductApiConstants.APP_API_PREFIX + "/{ids}",
      produces = MediaType.APPLICATION_JSON_VALUE
  )
  BaseResponse<Integer> delete(@PathVariable(value = "ids") Long[] ids);
}
